package com.itboye.mengwu.data.presenter;

import java.util.List;
import java.util.Observer;

import com.itboye.core.interfaces.ICompleteListener;
import com.itboye.core.object.BasePresenter;
import com.itboye.core.object.ResultEntity;
import com.itboye.mengwu.app.ui.main.MainPresenter;
import com.itboye.mengwu.data.interfaces.IMyTieziinterfaces;
import com.itboye.mengwu.data.model.MyTiezibean;
import com.itboye.mengwu.data.repository.MyTieZirepsotry;

public class Myteizipresenter extends BasePresenter implements IMyTieziinterfaces<MyTiezibean>{
	// 发表帖子
		public static final String OrderShengchengSuccess = MainPresenter.class.getName()
				+ "_OrderShengcheng_success";
		public static final String OrderShengchengFail = MainPresenter.class.getName()
				+ "_OrderShengcheng_failure";

	public Myteizipresenter(Observer observer) {
		super(observer);
		// TODO Auto-generated constructor stub
	}

	@Override
	public void add(MyTiezibean model) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void delete(MyTiezibean model) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void update(MyTiezibean model) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void getInfo(MyTiezibean model) {
		// TODO Auto-generated method stub
		IMyTieziinterfaces<MyTiezibean> addGoods = new MyTieZirepsotry(
				new ICompleteListener() {

					@Override
					public void success(ResultEntity result) {
						// TODO Auto-generated method stub
						result.setEventTag(Tag_Success);
						result.setEventType(OrderShengchengSuccess);
						setChanged();
						notifyObservers(result);
					}

					@Override
					public void failure(ResultEntity result) {
						// TODO Auto-generated method stub
						result.setEventTag(Tag_Success);
						result.setEventType(OrderShengchengFail);
						setChanged();
						notifyObservers(result);

					}
				});
		addGoods.getInfo(model);//("", "", "", "");
	}

	@Override
	public List<MyTiezibean> queryYouHuiQuan(MyTiezibean model) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void onClickShouCang(String tid, String uid, String favorite_value) {
		// TODO Auto-generated method stub
		IMyTieziinterfaces<MyTiezibean> addGoods = new MyTieZirepsotry(
				new ICompleteListener() {

					@Override
					public void success(ResultEntity result) {
						// TODO Auto-generated method stub
						result.setEventTag(Tag_Success);
						result.setEventType(OrderShengchengSuccess);
						setChanged();
						notifyObservers(result);
					}

					@Override
					public void failure(ResultEntity result) {
						// TODO Auto-generated method stub
						result.setEventTag(Tag_Success);
						result.setEventType(OrderShengchengFail);
						setChanged();
						notifyObservers(result);

					}
				});
		addGoods.onClickShouCang(tid, uid, favorite_value);
	}

}
